// 封装高阶组件
// 核心逻辑 有无token
import { userStore } from '@/store'
import { Navigate } from 'react-router-dom'

export const AuthRoute = ({ children }) => {
    const { user } = userStore()
    if (user?.accessToken) {
        return <>{children}</>
    } else {
        return <Navigate to="/login" replace />
    }
}